<?php
/* ========== ########## ========== ########## ========== ########## ========== */
/*                                                                              */
/*   WHMCS v4.1.2 NULLED R4 by FLIPMODE  [ BAD SYNTAX ]                         */
/*                                                                              */
/*                             INTERNAL BAD SYNTAX NULLED VERSION: 2.5.9.6 R4   */
/*                                                                              */
/*   ALL files have been analysed, cleaned and nulled of:                       */
/*     - Call Backs  (100%)                                                     */
/*     - Link Backs (95%)                                                       */
/*     - Licensing  (100%)                                                      */
/*     - Remote Links + URL's                                                   */
/*                                                                              */
/*   WHMCS v4.1.2 RELEASED: 4th November 2009                                   */
/*    -> FIRST v4.1.2 NULL R1: 19th November 2009                               */
/*    -> UPDATED v4.1.2 NULL R4: 27th November 2009                             */
/*                                                                              */
/*   TESTING + VERIFICATION::                                                   */
/*     Files Cleaned, Nulled, Checked, Verified By:                             */
/*      -> FLIPMODE!                                                            */
/*     Decoded By:                                                              */
/*      -> FLIPMODE! + Unknown Decoder                                          */
/*     Tested By:                                                               */
/*      -> FLIPMODE!, LeetWolf, and 12 Anonymous Users...                       */
/*     WHMCS 4.1.2 Supplied By:                                                 */
/*      -> WHM CompleteShit Coder @ WHMCS.com                                   */
/*                                                                              */
/*                                                                              */
/*   IMPORTANT NOTE::                                                           */
/*   PLEASE NOTE THIS IS FOR TRIAL PURPOSES ONLY!                               */
/*                          LIKE IT? THEN BUY IT!                               */
/*                                                                              */
/* ========== ########## ========== ########## ========== ########## ========== */


require '../dbconnect.php';
include '../includes/functions.php';

  /* $query = 'SELECT COUNT(*) FROM tblconfiguration WHERE setting=\'License\'';
  $result = full_query ($query);
  $data = mysql_fetch_array ($result);

   if (!$data[0])
   {
  	insert_query ('tblconfiguration', array ('setting' => 'License'));
   } */


/* if ($licenseconnectiontest)
{
	echo '<strong>License Server Connection Test</strong><br>Result: ';
	$url = 'http://74.54.136.210/~whmcscom/index.php';
	$ch = curl_init ();
	curl_setopt ($ch, CURLOPT_URL, $url);
	curl_setopt ($ch, CURLOPT_TIMEOUT, 30);
	curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
	$data = curl_exec ($ch);
	if (curl_error ($ch))
	{
		echo 'Error - ' . curl_error ($ch) . '<br><br>';
	}
	else
	{
		echo 'Success<br><br>';
	}

	curl_close ($ch);
	echo '' . 'Data:<br><textarea rows="20" cols="120">' . $data . '</textarea>';
	exit ();
}  */


    $licensing->remoteCheck ();

    /* if ($licensing->getStatus () != 'Active')
    {
        echo '<b><blink><font size="4" color="#FF0000">WARNING - LICENSE NOT ACTIVE...</font></blink></b>';

         header ('Location: licenseerror.php?licenseerror=' . $licensing->getStatus ());
    	 exit ();
    } */




if (($licensing->keydata['productname'] == 'Owned License' OR $licensing->keydata['productname'] == 'Owned License No Branding'))
{
	$releasedate = '20090930';
	$validversion = false;
	if ($licensing->keydata['addons'])
	{
		foreach ($licensing->keydata['addons'] as $addon)
		{
			if ($addon['name'] == 'Support and Updates')
			{
				if ($releasedate < str_replace ('-', '', $addon['nextduedate']))
				{
					$validversion = true;
					continue;
				}

				continue;
			}
		}
	}

   /*	if (!$validversion)
	{
		header ('Location: licenseerror.php?licenseerror=version');
		exit ();
	}  */
}

if (($action AND $disableadminforgottenpw))
{
	$action = '';
}

echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Billing &amp; Support - Login</title>

<style type="text/css">
<!--
body, td, th {
	font-family: Tahoma, Arial, Helvetica, sans-serif;
	font-size: 11px;
	color: #333;
}
body {
	background-color: #FFF;
	margin: 0;
}
a, a:visited {
	color: #000066;
	text-decoration: underline;
}
a:hover {
	text-decoration: none;
}
form {
	margin: 0;
	padding: 0;
}
input, select, textarea {
	font-family: Tahoma, Arial, Helvetica, sans-serif;
	font-size: 11px;
	padding: 3px;
}
#login_container {
	color: #333;
	background-color: #FFF;
	text-align: left;
	width: 330px;
	padding: 1px;
	margin: 20px auto 10px auto;
	border: 1px solid #CCCCCC;
}
#logo {
	text-align: center;
	margin: 0;
	padding: 50px 0 0 0;
}
#login_container #login {
	background-color: #EFEFEF;
	text-align: left;
	margin: 0;
	padding: 10px;
}
#login_container #login_failed {
    background-color: #FCF9D2;
    text-align: center;
    padding: 10px;
    margin: 0 0 1px 0;
}
#login_container #extra_info {
	background-color: #CCC;
	text-align: left;
	padding: 10px;
	margin: 1px 0 0 0;
}
-->
</style>

<script language="javascript">
function sf(){ document.frmlogin.username.focus(); }
</script>
</head>
<body';
    if (!$action)
    {
    	echo ' onload="sf()"';
    }

echo '>
    <div valign="center"><div valign="middle">
    <div id="logo"><img src="images/loginlogo.gif" alt="" width="205" height="62" /></div>
    <div id="login_container">
    ';
  if ($func == 'incorrect')
  {
    echo '  <div id="login_failed">

    <font face="Verdana"><strong><font color="#FF3300" style="font-size: 12px;">Login Failed. Please Try Again.</font></strong><br>Your IP has been logged and admins notified of this<br />failed login attempt.</font>
  </div>
';
}

if (!$action)
{
    echo '  <div id="login">
    <form action="dologin.php" method="post" name="frmlogin" id="frmlogin">
      <table width="100%" border="0" cellspacing="0" cellpadding="5">
        <tr>
          <td width="30%" align="right" valign="middle">
          <strong><font face="Verdana" style="font-size: 13px;">User Name</font></strong></td>
          <td align="left" valign="middle"><input type="text" name="username" size="30" /></td>
        </tr>
        <tr>
          <td width="30%" align="right" valign="middle">
          <strong><font face="Verdana" style="font-size: 13px;">Password</font></strong></td>
          <td align="left" valign="middle"><input type="password" name="password" size="30" /></td>
        </tr>
        <tr>
          <td width="30%" align="right" valign="middle"><input type="checkbox" name="rememberme" id="rememberme" /></td>
          <td align="left" valign="middle"><label for="rememberme" style="cursor:hand"><font face="Verdana" style="font-size: 10px;" color="#505050">Remember Login</font></label></td>

     </tr>
      </table>
      
       <div align="center" valign="middle"><input style="font-size: 14px; font-weight: bold;" type="submit" value="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LOG IN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" class="button" /> </div>
    </form>
  </div>
';
}
else
{
	if (($action == 'remind' AND !$disableadminforgottenpw))
	{
		if ($sub == 'send')
		{
			$result = select_query ('tbladmins', '', array ('email' => $email));
			$data = mysql_fetch_array ($result);
			$firstname = $data['firstname'];
			$lastname = $data['lastname'];
			$username = $data['username'];
			$email = $data['email'];
			if (!$email)
			{
				echo '<div id="login_failed">
    ';
				echo '<s';
				echo 'trong>Email Address Not Found</strong><br>Your IP has been logged and admins notified of this failed reminder attempt.
</div>
';
			}
			else
			{
				$length = 10;
				$seeds = 'ABCDEFGHIJKLMNPQRSTUVYXYZ0123456789abcdefghijklmnopqrstuvwxyz';
				$str = null;
				$seeds_count = strlen ($seeds) - 1;
				$i = 0;
				while ($i < $length)
				{
					$str .= $seeds[rand (0, $seeds_count)];
					++$i;
				}

				$newpassword = $str;
				update_query ('tbladmins', array ('password' => md5 ($newpassword)), array ('email' => $email));
				$message = '';
				if ($CONFIG['LogoURL'])
				{
					$message = '<p><a href="' . $CONFIG['Domain'] . '" target="_blank"><img src="' . $CONFIG['LogoURL'] . '" alt="' . $CONFIG['CompanyName'] . '" border="0"></a></p>';
				}

				$message .= '' . '<p>Dear ' . $firstname . ',</p><p>As requested, here is a new password for you to use to login to your admin area.</p><p>Login Details<br>-------------------------------<br>Username: ' . $username . '<br>Password: ' . $newpassword . '</p><p>If you did not request this change, you should change your account login details as soon as possible.</p><p><a href="' . $CONFIG['SystemURL'] . ('' . '/' . $customadminpath . '/">') . $CONFIG['SystemURL'] . ('' . '/' . $customadminpath . '/</a></p>');
				$mail = new PHPMailer ();
				$mail->From = $CONFIG['SystemEmailsFromEmail'];
				$mail->FromName = $CONFIG['SystemEmailsFromName'];
				$mail->Subject = 'New Password Generated';
				$mail->CharSet = $CONFIG['Charset'];
				if ($CONFIG['MailType'] == 'mail')
				{
					$mail->Mailer = 'mail';
				}
				else
				{
					if ($CONFIG['MailType'] == 'smtp')
					{
						$mail->IsSMTP ();
						$mail->Host = $CONFIG['SMTPHost'];
						$mail->SMTPAuth = true;
						$mail->Port = $CONFIG['SMTPPort'];
						$mail->Username = $CONFIG['SMTPUsername'];
						$mail->Password = $CONFIG['SMTPPassword'];
						$mail->Sender = $mail->From;
					}
				}

				if ($smtp_debug)
				{
					$mail->SMTPDebug = true;
				}

				$message = $message;
				$message_text = str_replace ('</p>', '

', $message);
				$message_text = str_replace ('<br>', '
', $message_text);
				$message_text = str_replace ('<br />', '
', $message_text);
				$message_text = strip_tags ($message_text);
				$mail->Body = $message;
				$mail->AltBody = $message_text;
				$mail->AddAddress ($email);
				if (!$mail->Send ())
				{
					echo '<p><b>There has been an error sending the message</b></p>';
				}
				else
				{
					echo '<p><b>A New Password has been Emailed to You</b></p>';
					logactivity ('' . 'New Password Requested for Admin Username ' . $username);
				}

				$mail->ClearAddresses ();
			}
		}

      echo '  <div id="login">
    <form action="login.php" method="post" name="frmlogin" id="frmlogin">
    <input type="hidden" name="action" value="remind" />
    <input type="hidden" name="sub" value="send" />
      <table width="100%" border="0" cellspacing="0" cellpadding="5">
        <tr>
          <td width="30%" align="right" valign="middle">
          <strong><font face="Verdana" style="font-size: 13px;">Email</font></strong></td>
          <td align="left" valign="middle"><input type="text" name="email" size="40" /></td>
        </tr>
        <tr>
          <td width="30%" align="right" valign="middle">&nbsp;</td>
          <td align="left" valign="middle"><input style="font-size: 14px; font-weight: bold;" size="100" type="submit" value="&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;SEND REMINDER&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;" class="button" /></td>
        </tr>
      </table>
    </form>
  </div>
';
	}
}

echo '  <div id="extra_info">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="right" valign="middle"><font color="#aaaaaa" face="Verdana"  style="font-size: 9px; text-decoration: none; font-weight: bold;">IP Logged: &nbsp;';
echo $remote_ip;
echo '</strong></td>
        <td align="right" valign="middle"><!-- CODE REMOVED! --></td>
      </tr>
    </table>
  </div>
</div>
<div align="center">';
if ($CONFIG['SystemSSLURL'])
{
	echo '<a href="';
	echo $CONFIG['SystemSSLURL'] . '/' . $customadminpath;
	echo '">Secure SSL Access</a> | ';
}

if (!$disableadminforgottenpw)
{
	echo '<font face="Verdana" style="font-size: 10px;"><a href="login.php?action=remind" style="text-decoration: none; font-color: bbbbbb;"><font color="#dddddd">Reset Password</font></a></font>';
}

echo '</div>
</body>
</html>';
?>